:root {
  --white: #979797;
  --grey: #575757;
  --black: #050505;
  --red: #ff7070;
  --light-green: #9fff9c;
  --light-red: #ff9c9c;
  --border-radius: 8px;
  --spacing-xs: 5px;
  --spacing-sm: 10px;
  --spacing-md: 15px;
  --spacing-lg: 20px;
  --spacing-xl: 40px;
  --container-width: 1200px;
  --shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
}

/* CSS RESET */

*,
*::before,
*::after {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html {
  /* footer support */
  position: relative;
  min-height: 100%;
}

body {
  background-color: var(--grey);
  color: var(--black);
  font-family: 'Poppins', sans-serif;
  font-size: 18px;
  font-weight: 500;
  word-wrap: break-word;
  /* footer support */
  margin-bottom: 100px;
}

button,
input {
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  cursor: pointer;
  outline: none;
}

input[type='text'],
input[type='number'] {
  cursor: text;
}

/* UTILS */

.container {
  max-width: var(--container-width);
  padding: var(--spacing-lg);
  margin: 0 auto;
}

.btn {
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius);
  transition: filter 0.15s ease-in-out;
}

.btn:hover {
  filter: brightness(90%);
}

.btn-add {
  font-size: 24px;
  font-weight: 600;
}

.btn-light-green {
  background-color: var(--light-green);
}

.btn-light-red {
  background-color: var(--light-red);
}

/* HEADER */

.header {
  background-color: var(--white);
  box-shadow: var(--shadow);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logged-in,
.logged-out {
  display: none;
}

.logged-in.active,
.logged-out.active {
  display: flex;
  gap: 20px;
}

/* MAIN */

.main {
  margin-top: var(--spacing-lg);
  text-align: center;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-xl);
  margin-top: var(--spacing-xl);
}

.book-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 20px;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius);
  background-color: var(--white);
  box-shadow: var(--shadow);
  line-height: 1.2;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

/* FOOTER */

.footer {
  position: absolute;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: var(--spacing-sm);
}

.fa-github {
  font-size: 24px;
  color: var(--black);
  transition: transform 0.3s ease-in-out;
}

.fa-github:hover {
  transform: rotate(360deg) scale(1.2);
}

/* MODALS */

.modal {
  position: fixed;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 300px;
  padding: var(--spacing-lg);
  border-radius: var(--border-radius);
  background-color: var(--grey);
  text-align: center;
  transform: translate(-50%, -50%) scale(0);
  transition: 0.2s ease-in-out;
}

.modal.active {
  transform: translate(-50%, -50%) scale(1);
}

.add-book-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
}

.add-book-form button {
  width: 100%;
}

.error-msg {
  display: none;
  color: red;
}

.error-msg.active {
  display: block;
  margin-top: -15px;
}

.input {
  width: 100%;
  padding: 10px;
  border-radius: var(--border-radius);
}

.is-read {
  display: flex;
  gap: var(--spacing-md);
}

.checkbox {
  width: 20px;
  height: 20px;
  margin-top: 4px;
  accent-color: white;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  display: none;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.overlay.active {
  display: block;
}

/* LOADING RING */

.lds-dual-ring {
  display: none;
  width: 38px;
  height: 38px;
}

.lds-dual-ring:after {
  content: ' ';
  display: block;
  width: 30px;
  height: 30px;
  margin: 8px;
  border-radius: 50%;
  border: 3px solid var(--black);
  border-color: var(--black) transparent var(--black) transparent;
  animation: lds-dual-ring 1.2s linear infinite;
}

.lds-dual-ring.active {
  display: block;
}

@keyframes lds-dual-ring {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* MEDIA QUERIES */

@media (max-width: 400px) {
  .header .container {
    flex-direction: column;
    gap: var(--spacing-md);
    padding-top: var(--spacing-sm);
  }

  .main {
    margin-top: 0;
  }

  :root {
    --spacing-xl: 20px;
  }
}